package com.abbas.test230430.view;

import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.Gravity;
import android.widget.LinearLayout;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.widget.AppCompatTextView;

import com.abbas.test230430.R;

public class TransactionTextView extends AppCompatTextView {

    private boolean isTitle = false;
    public TransactionTextView(@NonNull Context context,boolean isTitle) {
        super(context);
        this.isTitle = isTitle;
        init();
    }

    public TransactionTextView(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public TransactionTextView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    private void init(){
        setGravity(Gravity.CENTER);
        if (isTitle){
            setTextColor(Color.WHITE);
            setBackground(AppCompatResources.getDrawable(getContext(),R.drawable.transaction_title_shape));
        }else {
            setBackgroundColor(getResources().getColor(R.color.gray1));
        }
        setPadding(12,12,12,12);

    }
}
